<template>
  <div class="box">
    <div class="box1">
      <div class="word">Register</div>
      <v-form
        ref="form"
        lazy-validation
        style="
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          align-item: center;
          height: 50vh;
          width: 20vw;
        "
      >
        <v-text-field
          v-model="loginForm.username"
          :rules="[(v) => !!v || 'ID is required']"
          label="StudentID"
          required
          style="margin-top: 3vh"
        ></v-text-field>

        <v-text-field
          v-model="loginForm.password"
          :type="'password'"
          :rules="[(v) => !!v || 'Password is required']"
          label="Password"
          required
          style="margin-top: 3vh"
        ></v-text-field>

        <v-text-field
          v-model="password2"
          :type="'password'"
          :rules="[(v) => !!v || 'Password is required']"
          label="Password"
          required
          style="margin-top: 3vh"
        ></v-text-field>

        <v-alert
          v-model="alert_err"
          border="left"
          close-text="Close Alert"
          color="deep-purple accent-4"
          dark
          dismissible
        >
          两次密码不相同
        </v-alert>

        <v-btn
          style="height: 6vh; margin: 6vh auto; width: 20vw"
          color="info"
          @click="toLogin"
        >
          CONFIRM
        </v-btn>
      </v-form>
    </div>
  </div>
</template>

<script>

export default {
  data() {
    return {
      password2: "",
      loginForm: {
        username: "",
        password: "",
      },
      alert_err: false,
    };
  },
  methods: {
    toLogin() {
      this.$router.push("/login");
    },
  },
};
</script>

<style scoped>
.box {
  display: flex;
  width: 100%;
  height: 100vh;
  background: url("../../assets/login_bg.png") top left no-repeat;
  background-size: 100vw 100vh;
  justify-content: center;
  align-items: center;
}
.box1 {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  flex-direction: column;
  width: 26vw;
  height: 70vh;
  margin: 0 auto;
  background: #fff;
  padding: 20px 40px;
  border-radius: 10px;
  box-shadow: 0px 0px 30px 5px #eeeeee;
}
.register {
  margin-left: 13vw;
  font-size: 14px;
  color: #808080;
  text-decoration: underline;
}
.word {
  margin: 3vh auto;
  width: 100%;
  height: 3vh;
  text-align: center;
  line-height: 3vh;
  font-size: 22px;
  color: #0076f6;
}
</style>
